package ru.silviasaint.fridge.server.handler;

import com.gwtplatform.dispatch.server.ExecutionContext;
import com.gwtplatform.dispatch.server.actionhandler.ActionHandler;
import com.gwtplatform.dispatch.shared.ActionException;
import ru.silviasaint.fridge.shared.SampleAction;
import ru.silviasaint.fridge.shared.SampleResult;

/**
 * Created by Dmitry.
 * User: jetblack20
 * Date: 4/5/12
 * Time: 11:25 PM
 */
public class SampleActionHandler implements ActionHandler<SampleAction, SampleResult>{
    @Override
    public SampleResult execute(SampleAction sampleAction, ExecutionContext executionContext) throws ActionException {        
        String resp = "Server received : " + sampleAction.getRequest();
        SampleResult result = new SampleResult();
        result.setResponse(resp);
        return result;
    }

    @Override
    public Class<SampleAction> getActionType() {
        return SampleAction.class;
    }

    @Override
    public void undo(SampleAction sampleAction, SampleResult sampleResult, ExecutionContext executionContext) throws ActionException {

    }
}
